<template>
	<view>
		<view class="con">
			<view class="list jui_flex jui_flex_justify_between" v-for="(item, index) in list" :key="index">
				<view class="left" style="text-align: center;">
					<view class="text" style="color: #666;font-size: 28upx;margin-top: 16upx;">{{item.username}}</view>
					<view class="text paytype">
						<template>{{item.paytypename}}</template>
					</view>
				</view>
				<view>
					<view class="text" style="color: #666;font-size: 28upx;margin-top: 16upx;">
						
					</view>
					<view class="text" style="color: #666;font-size: 28upx;margin-top: 16upx; text-align: center;">
						{{item.updateTime}}
					</view>
				</view>
				<view class="right">
					<view style="display: flex; align-items: center">
						<view class="right-top-title" :style="{'border-color':item.direction === 'C' ? 'rgb(82, 196, 26)' : 'rgb(250, 140, 22)',color: item.direction === 'C' ? 'rgb(82, 196, 26)' : 'rgb(250, 140, 22)'}">{{item.direction === 'C' ? '借' : '贷'}}</view>
						<view class="text"
							:style="{color: item.direction === 'C' ? 'rgb(82, 196, 26)' : 'rgb(250, 140, 22)'}">
							<template>→{{item.transferUsername}}</template>
						</view>
					</view>

					<view class="text right-money" :style="{color: item.direction === 'C' ? 'rgb(82, 196, 26)' : 'rgb(250, 140, 22)'}">
						金额:{{item.paymoney || 0}}
					</view>
				</view>
			</view>
		</view>
		<empty position="jui_fixed" v-if="list.length < 1"></empty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				zfType: 0,
				q: {
					type: 1,
					pageNumber: 1,
					pageSize: 10
				},
				isLoading: true,
				hasMore: true,
				loadStatus: '',
				list: []
			}
		},
		onLoad() {
			let _token = uni.getStorageSync('token');
			this.q._token = _token
			this.getList();
		},
		onReachBottom() {
			if (this.hasMore) {
				this.q.pageNumber += 1;
				this.getList();

			}
		},
		onBackPress(options) {
			if (options.from === 'navigateBack') {
				return false;
			}
			this.back();
			return true;
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 2
				});
			},
			getList() {
				this.isLoading = true;
				this.$api.ptransfer(this.q).then(res => {
					this.isLoading = false;
					if(res.ok){
						if(res.data){
							if (res.data.rows.length != 0) {
								this.list = res.data.rows;
								this.hasMore = true;
								this.loadStatus = '';
							} else {
								this.hasMore = false;
								this.loadStatus = 'over';
							}
						}
					}
					
				});
			},
			onNav(nav, index) {
				this.zfType = index;
				this.q.type = nav.type;
				this.list = [];
				this.q.pageNumber = 1;
				this.getList();
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}
	.right-top-title {
		height: 30rpx;
		width: 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-width: 1rpx;
		border-style: solid;
		border-radius: 100%;
		font-size: 12px;

	}
	.right-money{
		margin-top: 16upx;
		font-size: 28upx;
	}
	.paytype {
		margin: 4px auto 0;
		width: 100%;
		text-align: center;
		border-radius: 18rpx;
	}
	.con {
		width: 100%;
		margin-top: 36upx;
		margin: 0 auto;
		.list {
			margin-bottom: 30upx;
			background: #fff;
			border-radius: 10upx;
			padding: 30upx 40rpx;
			display: flex;
			align-items: center;
			border-bottom: 1px solid #f4f4f4;
			image {
				width: 100upx;
				height: 100upx;
				border-radius: 100%;
			}
			.right {
				text-align: right;
				font-size: 32upx;
				color: #333;
				margin-left: 30upx;

				text {
					color: $zhuse;
				}
			}
		}
	}
	.order-nav {
		background: #fff;
		height: 80rpx;
		.nav-item {
			flex: 1;
			.item-title {
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: rgba(51, 51, 51, 1);
				line-height: 76rpx;
			}
			.nav-line {
				width: 38rpx;
				height: 8rpx;
				background: #fff;
				border-radius: 4px;
			}
			.line-active {
				background: $zhuse;
			}
		}
	}
</style>
